package com.xxxx.server.service.impl;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.xxxx.server.pojo.College;
import com.xxxx.server.mapper.CollegeMapper;
import com.xxxx.server.pojo.RespPageBean;
import com.xxxx.server.service.ICollegeService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * <p>
 * 学院表 服务实现类
 * </p>
 *
 * @author zhoubin
 * @since 2022-04-23
 */
@Service
public class CollegeServiceImpl extends ServiceImpl<CollegeMapper, College> implements ICollegeService {

    @Autowired
    private CollegeMapper collegeMapper;

    @Override
    public RespPageBean getCollegeByPage(Integer currentPage, Integer size, College college) {
        //开启分页
        Page<College> page = new Page<>(currentPage,size);
        IPage<College> collegeByPage = collegeMapper.getCollegeByPage(page,college);
        RespPageBean respPageBean = new RespPageBean(collegeByPage.getTotal(), collegeByPage.getRecords());
        return respPageBean;

    }

}
